package com.wmm.fast.main.shop2simplefactory;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Scanner;

/**
 * 写写画画 收银业务
 * 业务对象通过工厂构造,然后再调用业务方法..没啥好说的基础解耦. 含量很少.
 * @Auther: Token360
 * @Date: 2018/9/5 14:41
 * @Description:
 */
public class ShopCashiersExecute {

    private static Logger log = LoggerFactory.getLogger(ShopCashiersExecute.class);

    public static void working(String casher) {
        log.info("收银员[{}]Working...",casher);
        double payMoney = new Scanner(System.in).nextDouble();
        log.info("来了一位客人买了[{}]元的物品",payMoney);
        log.info("是VIP,参与打折优惠...开始结账");
        /** 使用简单工厂模式实现..缺点是暴露了除工厂以外的类,此场景可与策略模式结合进一步解耦 */
        ShopCashiersInterface shopCashiersInterface = ShopCashiersFactory.executeAcceptCashers(3,payMoney);
        shopCashiersInterface.acceptCash(payMoney);

    }

    public static void main(String[] args) {
        working("朔夜");
    }
}
